home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / getdig1r / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-08-19  |  4.6 KB  |  164 lines

  1. VERSION 5.00
  2. Object = "{F3376356-3242-11D3-83BB-F6844B1D6002}#1.1#0"; "CONTRO~1.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  4. Begin VB.Form Form1 
  5.    Caption         =   "List Maker"
  6.    ClientHeight    =   3480
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   4680
  10.    Icon            =   "Form1.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   3480
  13.    ScaleWidth      =   4680
  14.    StartUpPosition =   3  'Windows Default
  15.    Begin VB.CommandButton Command3 
  16.       Caption         =   "Reset Counter"
  17.       Height          =   315
  18.       Left            =   120
  19.       TabIndex        =   8
  20.       Top             =   3120
  21.       Width           =   4455
  22.    End
  23.    Begin MSComDlg.CommonDialog CommonDialog1 
  24.       Left            =   2160
  25.       Top             =   1320
  26.       _ExtentX        =   847
  27.       _ExtentY        =   847
  28.       _Version        =   393216
  29.    End
  30.    Begin VB.CommandButton Command2 
  31.       Caption         =   "Save List To txt File"
  32.       Height          =   375
  33.       Left            =   2400
  34.       TabIndex        =   6
  35.       Top             =   2760
  36.       Width           =   2175
  37.    End
  38.    Begin VB.TextBox Text1 
  39.       Height          =   285
  40.       Left            =   1680
  41.       TabIndex        =   5
  42.       Top             =   600
  43.       Width           =   2895
  44.    End
  45.    Begin VB.CommandButton Command1 
  46.       Caption         =   "Count"
  47.       Height          =   375
  48.       Left            =   120
  49.       TabIndex        =   4
  50.       Top             =   2760
  51.       Width           =   2175
  52.    End
  53.    Begin VB.ListBox List1 
  54.       Height          =   1425
  55.       ItemData        =   "Form1.frx":0442
  56.       Left            =   1680
  57.       List            =   "Form1.frx":0444
  58.       TabIndex        =   3
  59.       Top             =   960
  60.       Width           =   2895
  61.    End
  62.    Begin VB.DirListBox Dir1 
  63.       Height          =   1890
  64.       Left            =   0
  65.       TabIndex        =   1
  66.       Top             =   480
  67.       Width           =   1575
  68.    End
  69.    Begin VB.DriveListBox Drive1 
  70.       Height          =   315
  71.       Left            =   0
  72.       TabIndex        =   0
  73.       Top             =   120
  74.       Width           =   1575
  75.    End
  76.    Begin VB.Label Label2 
  77.       Height          =   255
  78.       Left            =   120
  79.       TabIndex        =   7
  80.       Top             =   2520
  81.       Width           =   4455
  82.    End
  83.    Begin VB.Label Label1 
  84.       Caption         =   "What type of file are you looking for?    ex: *.mp3 leave blank for *.*"
  85.       Height          =   495
  86.       Left            =   1680
  87.       TabIndex        =   2
  88.       Top             =   120
  89.       Width           =   2895
  90.    End
  91.    Begin ControlResizer.AutoResizer AutoResizer1 
  92.       Height          =   3255
  93.       Left            =   0
  94.       Top             =   0
  95.       Width           =   4695
  96.       _ExtentX        =   8281
  97.       _ExtentY        =   5741
  98.    End
  99. Attribute VB_Name = "Form1"
  100. Attribute VB_GlobalNameSpace = False
  101. Attribute VB_Creatable = False
  102. Attribute VB_PredeclaredId = True
  103. Attribute VB_Exposed = False
  104. Dim total As Integer
  105.     Dim FileArray() As String
  106.     Dim strFile As String
  107.     Dim x As Integer
  108.     Dim strFilePath As String
  109.     Dim strPath As String
  110. Private Sub Command1_Click()
  111. total = total + List1.ListCount
  112. Label2.Caption = "File Count= " & total
  113. End Sub
  114. Private Sub Command2_Click()
  115. On Error GoTo errhandler
  116. CommonDialog1.Filter = "Text Files (*.txt)|*.txt"
  117. CommonDialog1.ShowSave
  118. CommonDialog1.CancelError = True
  119. If Dir(CommonDialog1.FileName) = "" Then
  120.     Open CommonDialog1.FileName For Output As #1
  121.     Open CommonDialog1.FileName For Append As #1
  122. End If
  123.     Print #1,
  124.     Print #1, strPath
  125.     Print #1,
  126.     For x = 0 To List1.ListCount - 1
  127.         Print #1, List1.List(x)
  128.     Next x
  129.     Print #1,
  130.     Print #1,
  131.     Print #1, "Accumulated File Count= " & total
  132.     Print #1, "Made with ISeeAll's List Maker"
  133. Close #1
  134. errhandler:
  135. End Sub
  136. Private Sub Command3_Click()
  137. Label2.Caption = "File Count= 0"
  138. total = 0
  139. End Sub
  140. Private Sub Dir1_Change()
  141. List1.Clear
  142.  On Error GoTo errhandler
  143. strPath = Dir1.Path
  144. If Len(strPath) > 3 Then
  145.     strPath = strPath & "\"
  146. End If
  147. strPath = strPath & Text1.Text
  148. x = 0
  149.     strFile = Dir(strPath)
  150.     Do Until strFile = ""
  151.         ReDim Preserve FileArray(x)
  152.         FileArray(x) = strFile
  153.         strFile = Dir
  154.         x = x + 1
  155.     Loop
  156. For x = 1 To UBound(FileArray())
  157.     List1.AddItem FileArray(x)
  158. Exit Sub
  159. errhandler:
  160. End Sub
  161. Private Sub Drive1_Change()
  162. Dir1.Path = Drive1.Drive
  163. End Sub
  164.